package cn.nawang.ebeim.server.util;

import java.io.File;

import cn.nawang.ebeim.server.constants.Config;

/**
 * @ClassName: PathUtil
 * @Description: TODO
 * @author fanyb
 * @date Sep 11, 2015 9:55:27 AM
 * @version v1.0
 */
public class PathUtil {

  /**
   * 
   * @author fanyb
   * @Description: 获取本地文件下载路径
   * @param datasourceId
   * @param signature
   * @return String
   * @date Sep 11, 201510:01:39 AM
   *
   * @修改人
   * @修改日期
   */
  public static String getFileLocalPathDownload(String datasourceId, String signature) {
    String localPath = Config.WORKING_DIR + Config.FILE_DOWNLOAD + File.separator + datasourceId
        + File.separator + signature;
    return localPath;
  }

  /**
   * 
   * @author fanyb
   * @Description: 获取本地目录下载路径
   * @param datasourceId
   * @return String
   * @date Sep 11, 20153:35:45 PM
   *
   * @修改人
   * @修改日期
   */
  public static String getFileLocalDirectoryDownload(String datasourceId) {
    String localDirectoryPath =
        Config.WORKING_DIR + Config.FILE_DOWNLOAD + File.separator + datasourceId;
    return localDirectoryPath;
  }

  /**
   * 
   * @author fanyb
   * @Description: 获取本地文件上传路径
   * @param datasourceId
   * @param signature
   * @return String
   * @date Sep 11, 201510:01:39 AM
   *
   * @修改人
   * @修改日期
   */
  public static String getFileLocalPathUpload(String datasourceId, String signature) {
    String localPath = getFileLocalDirectoryUpload(datasourceId) + File.separator + signature;
    return localPath;
  }

  /**
   * 
   * @author fanyb
   * @Description: 获取本地目录上传路径(临时目录)
   * @param datasourceId
   * @return String
   * @date Sep 11, 20153:37:02 PM
   *
   * @修改人
   * @修改日期
   */
  public static String getFileLocalDirectoryUpload(String datasourceId) {
    String localDirectoryPath = Config.WORKING_DIR + Config.FILE_UPLOAD + File.separator
        + Config.TEMP_DS_FOLDER + File.separator + datasourceId;
    return localDirectoryPath;
  }

  /**
   * 
   * @author fanyb
   * @Description: 获取本地目录上传路径
   * @param datasourceId
   * @return String
   * @date Sep 28, 20155:12:46 PM
   *
   * @修改人
   * @修改日期
   */
  public static String getFileUploadBreakUpload(String datasourceId) {
    String localDirectoryPath =
        Config.WORKING_DIR + Config.FILE_UPLOAD + File.separator + datasourceId;
    return localDirectoryPath;
  }

  /**
   * 
   * @author fanyb
   * @Description: 获取本地版本树上传路径
   * @param datasourceId
   * @param signature
   * @return String
   * @date Sep 11, 201510:01:39 AM
   *
   * @修改人
   * @修改日期
   */
  public static String getVersionTreeLocalPathDownLoad(String datasourceId, String version) {
    String localPath = Config.WORKING_DIR + Config.VERSION_DOWNLOAD + File.separator + datasourceId
        + File.separator + version;
    return localPath;
  }

  public static String getVersionTreeLocalDirectoryDownLoad(String datasourceId) {
    String localDirectoryPath =
        Config.WORKING_DIR + Config.VERSION_DOWNLOAD + File.separator + datasourceId;
    return localDirectoryPath;
  }

  /**
   * 
   * @author fanyb
   * @Description: 获取版本树上传路径
   * @param datasourceId
   * @param signature
   * @return String
   * @date Sep 11, 201510:01:39 AM
   *
   * @修改人
   * @修改日期
   */
  public static String getVersionTreeLocalPathUpLoad(String datasourceId, String version) {
    String localPath = getVersionTreeLocalDirectoryUpLoad(datasourceId) + File.separator + version;
    return localPath;
  }

  public static String getVersionTreeLocalDirectoryUpLoad(String datasourceId) {
    String localDirectoryPath = Config.WORKING_DIR + Config.VERSION_UPLOAD + File.separator
        + Config.TEMP_DS_FOLDER + File.separator + datasourceId;
    return localDirectoryPath;
  }

  public static String getVersionTreeLocalBreakUpLoad(String datasourceId) {
    String localDirectoryPath =
        Config.WORKING_DIR + Config.VERSION_UPLOAD + File.separator + datasourceId;
    return localDirectoryPath;
  }


  /**
   * 
   * @author fanyb
   * @Description: 获取服务器上文件路径
   * @param datasourceId
   * @param signture
   * @return String
   * @date Sep 11, 201510:02:38 AM
   *
   * @修改人
   * @修改日期
   */
  public static String getFileServerPath(String datasourceId, String signature) {
    String serverPath =
        Config.LOCAL_SAVE_DIR + Config.FILE_SAVE_DIR + datasourceId + File.separator + signature;
    return serverPath;
  }

  public static String getFileServerDirectory(String datasourceId) {
    String serverDirectoryPath = Config.LOCAL_SAVE_DIR + Config.FILE_SAVE_DIR + datasourceId;
    return serverDirectoryPath;
  }

  /**
   * 
   * @author fanyb
   * @Description: 获取服务器上文件路径
   * @param datasourceId
   * @param signture
   * @return String
   * @date Sep 11, 201510:02:38 AM
   *
   * @修改人
   * @修改日期
   */
  public static String getVersionTreeServerPath(String datasourceId, String version) {
    String serverPath =
        Config.LOCAL_SAVE_DIR + Config.VERSION_SAVE_DIR + datasourceId + File.separator + version;
    return serverPath;
  }

  public static String getVersionTreeServerDirectory(String datasourceId) {
    String serverDirectoryPath = Config.LOCAL_SAVE_DIR + Config.VERSION_SAVE_DIR + datasourceId;
    return serverDirectoryPath;
  }
}
